package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * 点评对象
 */
@Getter@Setter
@JsonIgnoreProperties("handler")
public class StrategyComment extends BaseDomain{
    public static final Integer STATE_NORMAL = 0; //待审核
    public static final Integer STATE_DISABLE = 1; //禁用
    public static final Integer STATE_RELEASE = 2; //发布

    private Strategy strategy;//攻略

    private User user;//点评人

    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date createTime;//点评时间

    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date releaseTime;//发布时间

    private Integer greatCount = 0;//点赞数,默认为0

    private Integer star = 0;//星级 默认为0

    private Integer state = STATE_NORMAL;//状态

    private String content;//点评文本内容

    private Integer isCommend = 0;//是否为头条,默认为0,表示不是,1表示为头条

    private List<StrategyCommentImage> commentImages;//攻略点评图片列表

    private Integer replyCount = 0;//评论数量,默认为0

    public String getStarName(){
        String msg = "无星级";
        if (star == 1){
            msg = "一星级";
        } else if (star == 2){
            msg = "二星级";
        }else if (star == 3){
            msg = "三星级";
        }else if (star == 4){
            msg = "四星级";
        }else if (star == 5){
            msg = "五星级";
        }
        return msg;
    }

    public String getStateName(){
        String stateName = "待审核";
        if (state == STATE_DISABLE){
            stateName = "禁用";
        } else if (state == STATE_RELEASE){
            stateName = "发布";
        }
        return stateName;
    }
    public String getIsCommendName(){
        String mag = "否";
        if (isCommend == 1){
            mag = "是";
        }
        return mag;
    }
}